package com.forum.module.blog.dal.dataobject.favorite;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.forum.framework.mybatis.core.dataobject.BaseDO;

import java.util.Objects;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/2 18:13
 */
@TableName(value = "blog_favorite")
public class FavoriteDO extends BaseDO {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 文章编号
     */
    private Long articleId;

    /**
     * 点赞人编号
     */
    private Long userId;

    public FavoriteDO() {
    }

    public FavoriteDO(Long id, Long articleId, Long userId) {
        this.id = id;
        this.articleId = articleId;
        this.userId = userId;
    }

    public Long getId() {
        return id;
    }

    public FavoriteDO setId(Long id) {
        this.id = id;
        return this;
    }

    public Long getArticleId() {
        return articleId;
    }

    public FavoriteDO setArticleId(Long articleId) {
        this.articleId = articleId;
        return this;
    }

    public Long getUserId() {
        return userId;
    }

    public FavoriteDO setUserId(Long userId) {
        this.userId = userId;
        return this;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        FavoriteDO that = (FavoriteDO) object;
        return Objects.equals(id, that.id) && Objects.equals(articleId, that.articleId) && Objects.equals(userId, that.userId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, articleId, userId);
    }
}
